package com.hqyj.controller;

import com.hqyj.pojo.Classes;
import com.hqyj.pojo.Department;
import com.hqyj.pojo.User;
import com.hqyj.service.ClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

@Controller
@RequestMapping("classes")
public class ClassesController {
    @Autowired
    ClassesService classesService;

    @RequestMapping("classList")
    public String roomList(){return "class/classList";}

    @RequestMapping("select")
    @ResponseBody
    public HashMap<String,Object> select(Classes classes){
        return classesService.select(classes);
    }

    @RequestMapping("delete")
    @ResponseBody
    public HashMap<String,Object> delete(long id){
        return classesService.delete(id);
    }

    @RequestMapping("insert")
    @ResponseBody
    public HashMap<String,Object> insert(Classes classes){
        return classesService.insertNew(classes);
    }

    @RequestMapping("findDepartment")
    @ResponseBody
    public List<Department> findDepartment(Department department){
        return classesService.findDepartment(department);
    }

    @RequestMapping("findUser")
    @ResponseBody
    public List<User> findDepartment(){
        return classesService.findUser();
    }

    @RequestMapping("update")
    @ResponseBody
    public HashMap<String,Object> update(Classes classes){
        return classesService.update(classes);
    }
}
